#include "main.h"

uint t0=0;

void Init_timer()
{
	TMOD=0x01;//timer0
	TH0=(65535-20000)/256;//remeber to modify to 50ms
	TL0=(65535-20000)%256;
	EA=1;
	ET0=1;//tiemr0 Interrupt
}

void timer0() interrupt 1
{
	t0++;
	if(t0==20)
	{
		t0=0;
		cnt0--;
		TR0=0;
	}
	TH0=(65535-20000)/256;
	TL0=(65535-20000)%256;
}
